﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Sisocana.Core.Models.SearchPersonViewModel>" %>
<%@ Import namespace="Sisocana.Core.Models" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Search person
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<h2>SearchPersonResults</h2>
<%:Html.HiddenFor(model => model.IsAdvanced) %>
<% using (Html.BeginForm())
   {  %>		
    <table width="100%">
	    <tr>
		    <td align="right">
                <% string label = "";
                    if (Model.IsAdvanced)
                        label = "keyword >>";
                    else
                        label = "advanced >>"; %>
                <%: Html.ActionLink(label , "CambiarSearchForm", Model)%>
		    </td>
	    </tr>
    </table>

    <% if (Model.IsAdvanced)
        Html.RenderPartial("AdvancedSearchForm", Model);
    else
    { %>
    <fieldset>
        <%= Html.Div("editor-label", Html.LabelFor(model => model.Keyword)) %>
        <%= Html.Div("editor-field", Html.EditorFor(model => model.Keyword)) %>
        <%= Html.ValidationMessageFor(model => model.Keyword) %>                    
    </fieldset>
    <input type="submit" value="Search" />
    <% } %>
<% } %>

<% if (Model.results.Count != 0)
   { %>
            <fieldset>
                <legend>Search results </legend>
                <%= Html.DisplayFor(model => model.results )%>
            </fieldset>


<%--        <table>
            <tr>
                <th></th>
                <th>
                    Phone
                </th>
                <th>
                    Description
                </th>
                <th>
                    Date missing
                </th>
                <th>
                    Name
                </th>
                <th>
                    Last Name
                </th>

            </tr>

        <% foreach (Sisocana.Core.Models.PersonaDesaparecidaModel item in ViewBag.result)
           { %>
            <tr>
                <td>
                    <%: Html.ActionLink("Edit", "Edit", new { id = item.id })%> |
                    <%: Html.ActionLink("Delete", "Delete", new { id = item.id })%>
                </td>
                <td>
                    <%: Html.DisplayFor(modelItem => item.celular)%>
                </td>
                <td>
                    <%: Html.DisplayFor(modelItem => item.descripcion)%>
                </td>
                <td>
                    <%: Html.DisplayFor(modelItem => item.fecha)%>
                </td>
                <td>
                    <%: Html.DisplayFor(modelItem => item.nombre)%>
                </td>
                <td>
                    <%: Html.DisplayFor(modelItem => item.apellido)%>
                </td>

            </tr>
        <% } %>

        </table>--%>
<% }
   else
   { %>
   <p>No results.</p>
<%   } %>
</asp:Content>

<script runat="server">
    protected void Page_PreInit(Object sender, EventArgs e)
    {
        Master.MasterPageFile = Url.Content(ViewBag.Site.dir_master);
        MasterPage UserMaster = Master.Master;
        UserMaster.FindControl("NewsTitleContent").Visible = false;
        UserMaster.FindControl("VideoTitleContent").Visible = false;
        UserMaster.FindControl("ImageTitleContent").Visible = false;
    }
</script>